<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  props: {
    info: { type: Object, required: true },
    isActive: Boolean,
  },
});
</script>

<template>
  <view class="task-item">
    <template v-if="isActive">
      <image class="task-item-bg" :src="info.pic_url" mode="aspectFix" />
      <view class="task-item-desc">{{ info.desc }}</view>
    </template>
    <template v-else>
      <image class="task-item-bg2" :src="info.pic_url2" mode="aspectFix" />
      <view class="task-item-desc2">{{ info.desc }}</view>
    </template>
  </view>
</template>

<style lang="scss">
.task-item {
  position: relative;

  .task-item-bg,
  .task-item-bg2 {
    display: block;
    width: 224rpx;
    height: 200rpx;
  }

  .task-item-desc,
  .task-item-desc2 {
    position: absolute;
    left: 50%;
    top: 68rpx;
    width: 166rpx;
    font-size: 24rpx;
    color: #666666;
    line-height: 34rpx;
    transform: translateX(-50%);
  }

  .task-item-bg2 {
    width: 202rpx;
    height: 180rpx;
  }

  .task-item-desc2 {
    top: 62rpx;
    width: 146rpx;
    font-size: 20rpx;
    line-height: 28rpx;
  }
}
</style>